const moment = require('moment-timezone');

function formatTimeToChinaTime(dateStr) {
    return moment(dateStr).tz('Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss');
}

function getRandomString() {
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  let result = '';
  for (let i = 0; i < 20; i++) {
    result += chars.charAt(Math.floor(Math.random() * chars.length));
  }
  return result;
}


module.exports = {
    formatTimeToChinaTime,
    getRandomString
}